<template>
	<view class="container">
		<carHeader :title="'输入核销码'"></carHeader>
		<view class="top">
			<view class="input1">
				输入核销码
			</view>
			<view class="u-demo-block__content">
				<!-- #ifndef APP-NVUE -->
				<u-input>
				<!-- #endif -->
					<!-- #ifdef APP-NVUE -->
					<u--input placeholder="后置插槽">
					<!-- #endif -->
						<template slot="suffix">
							<u-button @tap="getCode" :text="tips" type="success" >识别</u-button>
						</template>
				<!-- #ifndef APP-NVUE -->
				</u-input>
				<!-- #endif -->
				<!-- #ifdef APP-NVUE -->
				</u--input>
				<!-- #endif -->
			</view>
		</view>

		<view class="bottom">
			<view class="bottom1">
				<text>核销码 MC1234-5678-9012</text>
			</view>

			<view class="bottom2">
				<text class="title">服务内容</text>
				<text class="zw">XXX标准洗车服务包含</text>
				<text class="zw">整车泡沫冲洗擦T</text>
				<text class="zw">轮胎轮椅冲洗情节</text>
				<text class="zw">车内清尘</text>
				<text class="zw">内饰脚垫简单除尘</text>
				<text class="zw">(不包含虫户、水泥、沥青和顽固污渍清理等)</text>

			</view>

			<view class="bottom3">
				<text class="title">订单信息</text>
				<text class="zw">订单金额：<text>￥ 30.00</text></text>
				<text class="zws">实付金额：<text>￥ 25.00</text></text>
				<text class="zw">优惠金额：<text>￥ 5.00</text></text>
				<text class="zw">订单编号：<text>2020032554565799</text></text>
				<text class="zw">支付时间：<text>2020.03.30 14:40:45</text></text>
				<text class="zw">预约时间：<text>2020.03.30 14:40</text></text>
			</view>
		</view>

		<view>
			<!-- <button class="status" @click="openPopup">{{ buttonText }}</button> -->
			<button class="status" @click="openPopup" v-if="flag">确认核销</button>
			<button class="status2" v-else="">已核销</button>
			<uni-popup ref="popup" type="dialog">
				<view class="custom-dialog">
					<text>核销此订单</text>
					<text>请您仔细核对订单,此操作不可撤销,请谨慎选择！</text>
					<view class="button-confirm">
						<button @click="closePopup" class="button-confirm1">取消</button>
						<button @click="confirm" class="button-confirm2">确认</button>

					</view>
				</view>

			</uni-popup>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				// buttonText: '确认核销'
				flag:true,
			};
		},
		methods: {
			openPopup() {
				this.$refs.popup.open();
			},
			closePopup() {
				this.$refs.popup.close();

			},
			confirm() {
				// 执行核销操作  
				console.log('核销成功');
				this.flag = false;
				// uni.navigateTo({
				// 	url:"/pages/hexiao2/hexiao2"
				// })
				// 关闭对话框  
				this.closePopup();
				// TODO: 在这里添加其他核销后的逻辑  
			},
		},
	};
</script>
<style lang="scss">
	.container {
		position: relative;

		.top {
			width: 720rpx;
			height: 160rpx;
			background-color: white;
			position: absolute;
			z-index: 1;
			border-radius: 30rpx;
			left: 15rpx;
			top: 90rpx;
			display: flex;
			justify-content: center;
			align-items: center;

			.input1 {
				color: #2E80F9;
				font-size: 30rpx;
			}

			.u-input {
				height: 60rpx;
				border-radius: 50rpx;

				.u-button {
					background-color: #2E80F9;
					color: white;
					width: 150rpx;
					border-radius: 40rpx;
					left: 15rpx;
				}

			}
		}

		.bottom {
			width: 720rpx;
			height: 900rpx;
			background-color: white;
			position: absolute;
			top: 280rpx;
			left: 15rpx;
			border-radius: 30rpx;
			display: flex;
			justify-content: center;
			flex-direction: column;
			align-items: center;

			.bottom1 {
				display: flex; // 启用Flexbox  
				align-items: center; // 垂直居中  
				justify-content: center; // 如果需要水平居中也可以添加这个，但在这个例子中可能不是必需的  
				margin-top: -30rpx;
				width: 680rpx;
				height: 100rpx;
				border-bottom: 1rpx solid gray;
				font-size: 18px;
				font-weight: 600;
			}

			.bottom2 {
				width: 680rpx;
				height: 350rpx;
				border-bottom: 1rpx solid gray;
				margin-top: 40rpx;
				display: flex;
				flex-direction: column;

			}

			.bottom3 {
				width: 680rpx;
				height: 350rpx;
				margin-top: 30rpx;
				display: flex;
				flex-direction: column;

			}


		}

		.status {
			position: absolute;
			background-color: #2E80F9;
			color: white;
			width: 500rpx;
			height: 80rpx;
			top: 1220rpx;
			left: 130rpx;
			border-radius: 100rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			font-size: 35rpx;
		}
		
		.status2 {
			position: absolute;
			background-color: #808080;
			color: white;
			width: 500rpx;
			height: 80rpx;
			top: 1220rpx;
			left: 130rpx;
			border-radius: 100rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			font-size: 35rpx;
		}

	}

	.title {
		font-size: 40rpx;
		font-weight: 600;
		margin-top: -22rpx;

	}

	.zw {
		margin-top: 9rpx;

	}

	.zws {
		margin-top: 9rpx;
		font-weight: 600;
	}



	.custom-dialog {
		/* 添加你的对话框样式 */
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 20px;
		border-radius: 10px;
		background-color: #fff;

		/* 其他样式... */
		.button-confirm {
			display: flex;


		}
	}

	.custom-dialog text {
		/* 文本样式 */
		margin-bottom: 10px;
		font-size: 40rpx;
		font-weight: 500;
		text-align: center;
	}

	.button-confirm1 {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 200rpx;
		height: 60rpx;
		border-radius: 30rpx;
		margin-right: 30rpx;
		margin-top: 20rpx;

	}

	.button-confirm2 {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 200rpx;
		height: 60rpx;
		border-radius: 30rpx;
		margin-right: 30rpx;
		margin-top: 20rpx;
		color: white;
		background-color: #2E80F9;
	}
</style>